package redis;


import com.bbcare.followup.plat.service.IFollowEvaluationService;
import com.bbcare.followup.plat.store.ibatis.ICommonDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.Test;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

import javax.annotation.Resource;
import java.util.Map;

@ContextConfiguration(locations = {"classpath*:/ibatis-config.xml",
        "classpath*:/spring-mvc.xml", "classpath*:/spring-mybatis.xml"
})
public class Postion入数据库 extends AbstractTestNGSpringContextTests {


    @Resource(name = "jedisPool")
    private JedisPool jedisPool;
    @Autowired
    private ICommonDao iCommonDao;
    @Autowired
    private IFollowEvaluationService iFollowEvaluationService;

    @Test
    public void handle() throws Exception{
        Jedis jedis = jedisPool.getResource();
        jedis.select(0);
        Map json = jedis.hgetAll("ExaminationPaper");

        json.forEach((k,v) -> {
            String sql = " INSERT INTO `scale_postion`( `key`, `value`,`type`) VALUES ( '"+k+"', '"+v+"',2);  ";
            iCommonDao.insert(sql);
        });
    }

    @Test
    public void testGetPostion() throws Exception {
       // iFollowEvaluationService.getPostion();

    }


}
